package cn.byapps.chensheng.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import cn.byapps.chensheng.entity.WxAccount;

/**
 * @author iva0512@gmail.com
 */
public interface WxAccountDao {
    @Results(id = "item",value={
        @Result(property = "id", column = "id",id = true),
        @Result(property = "appId", column = "app_id"),
        @Result(property = "secret", column = "secret"),
        @Result(property = "token", column = "token"),
        @Result(property = "aesKey", column = "aes_key"),
        @Result(property = "name", column = "name")
     }
    )
    @Select("select * from wx_account")
    List<WxAccount> findAll();
    
    @ResultMap("item")
    @Select("select * from wx_account")
    List<WxAccount> findByPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);

    @ResultMap("item")
    @Select("select * from wx_account where app_id = #{appid}")
	List<WxAccount> findByAppId(String appid);
}